package com.yuntian.service.Impl;

import com.yuntian.entity.CustomerMaster;
import com.yuntian.mapper.CustomerMapper;
import com.yuntian.mapper.OrderMapper;
import com.yuntian.service.CustomerService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 顧客マスタM001 顾客服务实现类
 * @author yuntian
 */
@Service
@RequiredArgsConstructor
public class CustomerServiceImpl implements CustomerService {

    private final CustomerMapper customerMapper;

    private final OrderMapper orderMapper;

    @Override
    public List<CustomerMaster> getCustomerList() {
        // 从数据库中查询所有顾客
        List<CustomerMaster> customerList = customerMapper.getCustomerList();
        return customerList;
    }

    /**
     * 根据受注代码获取顾客信息
     * @param orderId 受注代码
     * @return 顾客信息
     */
    @Override
    public CustomerMaster getCustomerById(String orderId) {
        // 从数据库中查询顾客信息
        CustomerMaster customerMaster = orderMapper.getCustomerById(orderId);
        return customerMaster;
    }

    @Override
    public CustomerMaster selectCustomerByCode(String kokyakuCode) {
        //todo 根据ko查找customer
        CustomerMaster customerMasters = customerMapper.seleybycode(kokyakuCode);
        return customerMasters;
    }

    @Override
    public List<CustomerMaster> selectCustomerAll() {
        /*return*/;
        return null;
    }
}
